﻿using Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.Configers
{
    public class CMKConfigers : IEntityTypeConfiguration<CMK>
    {
        public void Configure(EntityTypeBuilder<CMK> builder)
        {
            builder.ToTable(nameof(CMK));
            builder.Property(x => x.MajorKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.MajorKindName).IsRequired(false).HasMaxLength(60);
            builder.HasData(new CMK()
            {
                MfkId = 1,
                MajorKindId = "01",
                MajorKindName = "销售"
            }, new CMK()
            {
                MfkId = 2,
                MajorKindId = "02",
                MajorKindName = "软件开发"
            }, new CMK()
            {
                MfkId = 3,
                MajorKindId = "03",
                MajorKindName = "人力资源"
            }, new CMK()
            {
                MfkId = 4,
                MajorKindId = "04",
                MajorKindName = "生产部"
            }
            );
        }
    }
}

